package com.sdruixinggroup.mondayb2b.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.sdruixinggroup.mondayb2b.R;
import com.sdruixinggroup.mondayb2b.models.MessagetBeen;

/**
 * Created by 00029935 on 2017/11/18.
 */

public class SystemMessageAdapter extends QuickAdapter<MessagetBeen.MessagesBean.DataBean> {
    private Context context;

    public SystemMessageAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getLayoutID(int viewType) {
        return R.layout.system_message_adapter_item;
    }

    @Override
    public void convert(VH holder, MessagetBeen.MessagesBean.DataBean itemData, int position) {
        TextView tvtitle = holder.getView(R.id.tv_title);
        tvtitle.setText(itemData.getTitle());

        ImageView ivPic = holder.getView(R.id.iv_pic);
        Glide.with(context).load(itemData.getPic()).error(R.mipmap.news_banner).into(ivPic);

        TextView tvmessage = holder.getView(R.id.tv_message);
        tvmessage.setText(itemData.getContent());

        TextView time = holder.getView(R.id.tv_time);
        time.setText(itemData.getCreated_time());
        if(position == 0){
            time.setVisibility(View.VISIBLE);
        }else {
            time.setVisibility(View.VISIBLE);
        }
    }
}
